The present invention, in some embodiments thereof, relates to COBOL (Common Business Oriented Language) programs, and, more specifically, but not exclusively, to methods for scanning valid paths of COBOL programs.
When working with computer programs, all valid interprocedural execution paths in the program should be identified. In doing so, unreachable code, dead code, context-sensitive data flow analysis, finding static non-termination, and behavior preserving transactions, including procedure extraction can be identified.
COBOL programs present unique challenges, due to COBOL's unique control flow semantics. These semantics allow paragraphs and sections to be called, using PERFORM commands, and also executed as normal flow, using GOTO or FALL-THROUGH commands.
Existing solutions are time consuming and not reliable, as they cannot find all valid paths, by either checking for such paths or reporting that code was unreachable, when it was actually reachable via valid paths. This created unsafe situations, as this supposedly unreachable code was removed or altered from the program, resulting in problems with the program. Moreover, the existing solutions are performed in exponential time, which is extremely long for performance, and do not scale to accommodate large programs. An algorithm is performed in exponential time, if T(n) is upper bounded by 2poly(n), where poly(n) is a polynomial in n. More formally, using big O notation, an algorithm is in exponential time, if T(n) is bounded by O(2n^k), for a constant k.